import React from 'react'
import { TopicWrapper, TopicItem } from '../style'
import { connect } from 'react-redux'

class Topic extends React.PureComponent {
  render() {
    const { list } = this.props
    return (
      <TopicWrapper>
        {list.map(item => (
          <TopicItem key={item.get('id')}  href='https://www.baidu.com'>
            <img
              className="topic-pic"
              src={item.get('imgUrl')}
              alt=''
            />
            <span className="name">{item.get('title')}</span>
          </TopicItem>
        ))}
      </TopicWrapper>
    )
  }
}

const mapState = state => {
  return {
    list: state.getIn(['home', 'topicList'])
  }
}

export default connect(
  mapState,
)(Topic)
